package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.ParkingRuleDO;

import javax.validation.constraints.NotNull;

/**
 * Created by well on 15/11/12.
 */
public class ParkingRuleEditForm extends ParkingRuleForm{

    @NotNull(message = "不能为空")
    private Long ruleId;

    public Long getRuleId() {
        return ruleId;
    }

    public void setRuleId(Long ruleId) {
        this.ruleId = ruleId;
    }

    public void initForm(ParkingRuleDO parkingRuleDO){
        setRuleId(parkingRuleDO.getRuleId());
        setRuleStatus(parkingRuleDO.getRuleStatus());
        setVarId(parkingRuleDO.getVarId());
        setFeeUnit(PriceUtil.formatCNY(parkingRuleDO.getFeeUnit()));
        setVillageId(parkingRuleDO.getVillageId());
    }

    public ParkingRuleDO toDO() {
        ParkingRuleDO parkingRuleDO = super.toDO();
        parkingRuleDO.setRuleId(ruleId);
        return parkingRuleDO;
    }
}
